using UnityEngine;
using QFramework;
using UnityEngine.U2D;

namespace ProjectSurvivor
{
	public partial class TreasureChestPanel : ViewController,IController
	{
		ResLoader mResLoader = ResLoader.Allocate();
		SpriteAtlas iconAtlas;
		void Awake()
		{
			iconAtlas = mResLoader.LoadSync<SpriteAtlas>("Icon");
			BtnSure.onClick.AddListener(() =>
			{
				Time.timeScale = 1.0f;
				this.Hide();
			});
		}
		public void OnEnable()
		{
			Debug.Log(Global.tipe.Value);
			switch (Global.tipe.Value)
			{
				case 0: icon.sprite = iconAtlas.GetSprite("bomb"); Content.text="升级炸弹"; break;
				case 1: icon.sprite=iconAtlas.GetSprite("simple_sword");Content.text = "升级剑"; Global.SimpleSwordCount.Value++; break;
				case 2: icon.sprite=iconAtlas.GetSprite("movement_icon");Content.text = "升级速度";Global.speed.Value++; break;
				case 3: icon.sprite=iconAtlas.GetSprite("simple_sword");Content.text = "升级匕首"; Global.SimpleSwordCount.Value++;  break;
				case 4: icon.sprite=iconAtlas.GetSprite("fly_icon"); Content.text="升级篮球";Global.SimpleSwordCount.Value++; break;
			}
			Global.tipe.Value = -1;

		}

		public void OnBeforeDestroy()
		{

		}

        public IArchitecture GetArchitecture()
        {
            return Global.Interface ;
        }
    }
}


